<template>
	<view style="padding-bottom:60rpx;position: relative;z-index: 101;">
		<m-tabbar v-if="tabbar" fixed fill :current="current" :tabbar="tabbar" @change='change' :safeBottom="true"></m-tabbar>
	</view>
</template>
<script>
	import TabbarConfig from './config.js'
	export default {
		props: {
			current: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				tabbar: null,
			}
		},

		mounted() {
			try{
				let userInfo = uni.getStorageSync('USER_INFO')
				if(typeof userInfo =='string'){
					userInfo = JSON.parse(userInfo)
				}
				if (userInfo) {
					if (userInfo['is_manager']) {
						TabbarConfig.list[1] = {
							index: 1,
							"pagePath": "pages/goods_cate/goods_cate",
							"iconPath": "static/images/2-001.png",
							"selectedIconPath": "static/images/2-002.png",
							"text": "分类"
						}
					} else {
						TabbarConfig.list[1] = {
							index: 1,
							"pagePath": "pages/store_cate/store_cate",
							"iconPath": "static/images/gg.png",
							"selectedIconPath": "static/images/gga.png",
							"text": "门店"
						}
					}
					console.log('8822222222222222222222222222228888', userInfo);
					this.tabbar = TabbarConfig
				} else {
					console.log('8888');
					this.tabbar = TabbarConfig
				}
			}catch(e){
				//TODO handle the exception
				this.tabbar = TabbarConfig
			}
		},
		methods: {
			change(e) {
				console.log(e, 'change');
			}
		}
	}
</script>
<style scoped lang="scss">

</style>